<!DOCTYPE html>
<html>
<head th:include="cultivateWeb/header :: culHeaderCss"></head>
<style>
    .my_bg {
        margin: 10px 0;
        border-bottom: 1px solid #efefef;
        padding: 10px 40px;
    }
    .left{float: left}
    .right{float: right}
    .title_1{
        color: #333;
        font-size: 15px;
        font-weight: 700;
    }
    .title_2 {
        display: inline;
        color: #888;
        font-size: 15px;
        line-height: 22px;
    }
    .my_btn {
        margin-top: 10px;
        cursor: pointer;
        border: 1px solid #ff751a;
        font-size: 14px;
        padding: 2px 4px;
        color: #ff751a;
        width: 100px;
        text-align: center;
    }
</style>
<body>
<!-- 顶部导航 -->
<header th:include="cultivateWeb/header :: header"></header>
<link type="text/css" href="/css/cultivateWeb/style/course.css" rel="stylesheet">
<div style="background-color: #f7f7f7; ">
    <div class="layui-container">
        <p style="line-height: 40px">当前位置：<a href="/cultivate/homepage">首页</a> > <a href="/cultivate/study/studyOnline">在线学习</a> > 答题解析</p>
        <input th:value="${id}" type="hidden" id="courseId" />
    </div>
    <section>
        <div class="layui-container">
            <div style="font-size: 20px; font-weight: bold;margin-bottom:40px;">试卷列表</div>
            <div id="chapterList">
            </div>
        </div>
    </section>
</div>

<!-- footer ------------------------------------------------------- -->
<div class="footer" th:include="cultivateWeb/header :: footer"></div>
</body>
<script>
    selChapterList();
    function selChapterList() {
        ajaxToken("/jzApi/topic/selTraAnswerList", 'GET',
            {
                id: $("#courseId").val()
            }, function (res) {
                var categoryList = '';
            if(res.length!=0){
                var a='';
                var b='';
                res.forEach(function (item, index) {
                    if(item.type==0){
                        a = '练习试卷';
                        b='<a class="right my_btn" href="/cultivate/study/studyAnswerDetail?answerId='+item.id+'&courseId='+$("#courseId").val()+'">查看解析</a>'
                    }
                    if(item.type==1){
                        a = '测试试卷';
                        b=''
                    }
                    categoryList +='<div class="my_bg">' +
                        '                    <div>' +
                        '                        <div class="left"><span class="title_1">试卷名称：</span><span class="title_2">'+item.tpaperName+'</span></div>' +
                        '                        <div class="right"><span class="title_1">分数：</span><span class="title_2" style="color: green">'+item.score+'分</span></div>' +
                        '                        <div style="clear: both"></div>' +
                        '                    </div>' +
                        '                    <div>' +
                        '                        <div class="left"><span class="title_1">试卷类型：</span><span class="title_2">'+a+'</span></div>' +
                        b +
                        '                        <div style="clear: both"></div>' +
                        '                    </div>' +
                        '                </div>';

                });
            }else{
                categoryList='暂无数据'
            }
                $("#chapterList").html(categoryList);
            }
        )
    }
</script>

</html>